package game.players.user;

import com.uqbar.vainilla.DeltaState;
import com.uqbar.vainilla.events.constants.Key;

import game.ball.Possessed;
import game.ball.SoccerBall;
import game.players.SoccerPlayer;
import game.players.states.WithBall;

public class ServingUserPlayer extends WithBall {

	public ServingUserPlayer(SoccerPlayer player, SoccerBall ball) {
		super(player, ball);
		ball.setState(new Possessed(player,ball));
	}

	@Override
	public void update(DeltaState deltaState) {
		if(this.getTeammates().isEmpty())
			this.setTeammates(this.getPlayer().getScene().getTeammates());
		
		if(deltaState.isKeyPressed(Key.X)) {
			this.getPlayer().setState(new PassingUserPlayer(this.getPlayer(), this.getClosestMate()));
		}
	}

	@Override
	public boolean isRight() {
		return true;
	}

	@Override
	public void loseTheBall() {
		//No aplica
	}

}
